﻿@{ 
    ViewBag.Title = "配置数据库";
    var dbExist = ViewData["DbExist"]?.To<bool>();

    var dbFile = ViewData["DbFile"].To<bool>();
}
@model DbInitViewModel
    @if (dbFile)
    {
        <div class="alert alert-danger">
            <h4><i class="fa fa-times-circle"></i> 请手动删除 SingleBlog.db.lock 再执行安装程序！！</h4>
        </div>

    }
    else
    {

<form method="post">
    @if (dbExist.HasValue && dbExist.Value)
    {
        <div class="alert alert-warning">
            <h3>
                <i class="fa fa-info-circle"></i> 检测到数据库已存在，若执行安装，将会删除数据库以及所有数据！！！
            </h3>
        </div>
    }
    <h3>配置管理员帐号</h3>
    <hr />
    @if (ViewContext.ModelState.ErrorCount > 0)
    {
        <div asp-validation-summary="All" class="alert alert-danger"></div>
    }
    <div class="form-group">
        <div class="row">
            <label class="control-label  col-1" asp-for="Account">帐号</label>
            <input class="form-control col-3" asp-for="Account" placeholder="英文或数字"/>
            <span asp-validation-for="Account" class="text-danger  col-5"></span>
        </div>
    </div>
    <div class="form-group">
        <div class="row">
            <label class="control-label col-1" asp-for="Password">密码</label>
            <input class="form-control col-3" asp-for="Password" placeholder="不能少于6个字符"/>
            <span asp-validation-for="Password" class="text-danger  col-5"></span>
        </div>
    </div>
    <div class="form-group">
        <div class="row">
            <label class="control-label col-1" asp-for="Email">邮箱</label>
            <input class="form-control col-3" asp-for="Email" placeholder="系统错误时通知的邮箱"/>
            <span asp-validation-for="Email" class="text-danger col-5"></span>
        </div>
    </div>
    <div class="form-group">
        <button class="btn btn-primary" type="submit">配置完毕，开始执行安装</button>
    </div>
</form>
@section scripts{ 
    @Html.Partial("/Pages/Shared/_ValidationScripts.cshtml")
}
    }